Skip to content

fix(build): save assets and scenes before BuildPlayer - #1340

Merged
Scriptwonder merged 1 commit into
CoplayDev:betafrom
TeapoyY:fix/save-before-build
Aug 31, 2026
Merged

fix(build): save assets and scenes before BuildPlayer#1340
Scriptwonder merged 1 commit into
CoplayDev:betafrom
TeapoyY:fix/save-before-build

Conversation

@TeapoyY

@TeapoyY TeapoyY commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #1341

Summary

  • Call AssetDatabase.SaveAssets() and EditorSceneManager.SaveOpenScenes() in BuildRunner before BuildPipeline.BuildPlayer runs
  • Prevents manage_build from blocking on Unity's unsaved-scene save dialog when scenes or assets were modified

Test plan

  • Open a scene, modify it without saving, then run manage_build with action build
  • Confirm the build starts without a save popup
  • Confirm assets with unsaved changes are persisted before the build completes

Prevent manage_build from blocking on Unity's unsaved-scene dialog by
calling AssetDatabase.SaveAssets and EditorSceneManager.SaveOpenScenes
before BuildPipeline.BuildPlayer runs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9ffc8f0c-c4a1-43da-8e66-1c44f6a3ab25

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@TeapoyY
TeapoyY changed the base branch from main to beta August 21, 2026 19:02
@TeapoyY TeapoyY closed this Aug 21, 2026
@TeapoyY TeapoyY reopened this Aug 21, 2026
singam96 added a commit to singam96/unity-mcp that referenced this pull request Aug 30, 2026
@Scriptwonder

Copy link
Copy Markdown
Collaborator

Thanks!

@Scriptwonder
Scriptwonder merged commit 498acd1 into CoplayDev:beta Aug 31, 2026
5 checks passed
Scriptwonder added a commit that referenced this pull request Aug 31, 2026
#1340 added SaveBeforeBuild() so manage_build would not block on Unity's
unsaved-scene dialog, but it called EditorSceneManager.SaveOpenScenes()
unconditionally. A scene that has never been saved carries an empty path, and
handing one to Unity's save API opens the modal "Save Scene" file panel --
the exact block the change was meant to prevent. The warning it logs fires
only after SaveOpenScenes() returns, which is after the modal has already
stalled the main thread.

Saves dirty scenes individually and skips pathless ones with a warning,
mirroring the guard TestRunnerService.SaveDirtyScenes has carried since it hit
the same problem. ManageScene refuses the same case at ManageScene.cs:492.

Follow-up to #1340. Refs #1341
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

manage_build blocks on unsaved scene save dialog

2 participants